<% layout('/layouts/default.html', {title: 'dc_sup_task_group_unit管理', libs: ['dataGrid']}){ %>
<div class="main-content">
	<div class="box box-main">
		<div class="box-header">
			<div class="box-tools pull-right">

			</div>
		</div>
		<div class="box-body">
			<#form:form id="searchForm" model="${dcSupExamGroupUnit}" action="${ctx}/exam/dcSupExamSumScoreResult/groupListData" method="post" class="form-inline "
					data-page-no="${parameter.pageNo}" data-page-size="${parameter.pageSize}" data-order-by="${parameter.orderBy}">
						<#form:hidden path="groupId" />
				<div class="form-group">
					<i class="fa ">	<a href="#"  class="btn btn-primary" onclick="addUnit('${dcSupExamGroupUnit.groupId}')"    style="" title="${text('机构录入')}">机构录入</a>
					</i>
				</div>
		</#form:form>
			<table id="dataGrid"></table>
		</div>
	</div>
</div>
<% } %>
<script>
// 初始化DataGrid对象
$('#dataGrid').dataGrid({
	searchForm: $("#searchForm"),
	columnModel: [
		{header:'${text("单位名称")}', name:'unitName', index:'a.unit_name', width:150, align:"left"
			,formatter: function(val, obj, row, act){
				return row.unitName+'<a href="${ctx}/exam/dcSupExamSumScoreResult/delete?id='+row.id+'" style="float: right;" class="btnList" title="${text("删除机构")}" data-confirm="${text("确认要删除该机构吗？")}"><i class="fa fa-trash-o"></i></a>';
			},unformat: function(val, obj, cell){
				return $('#'+obj.rowId+'_unitName').val();
			}}
	],
	inputPageSize:10000,
	// 加载成功后执行事件
	ajaxSuccess: function(data){
		
	}
});

function addUnit(groupId){
	js.layer.open({
		type: 2,
		title: ['新增常用组机构'],
		area: ['800px', '600px'],
		scrollbar: true,
		shadeClose: false,
		content: "${ctx}/exam/dcSupExamSumScoreResult/orgForm?groupId="+groupId+"&isGroupOptions=1",
		btn1: function (index, layero) {

		},
		end:function () {
			location.reload();
		},
		success:function (layero,index){
			var body = layer.getChildFrame('body', index);
			var iframeWin = window[layero.find('iframe')[0]['name']]; //得到iframe页的窗口对象，执行iframe页的方法：iframeWin.method();
			body.find('input').val('Hi，我是从父页来的')
		}
	});

	// layer.open({
	// 	type: 2,
	// 	title: ['新增常用组机构'],
	// 	area: ['800px', '600px'],
	// 	// groupId 随便传  isGroupOptions 非常用组功能使用传 0  type  1 为区县 2 为市直
	// 	content: "${ctx}/exam/dcSupExamSumScoreResult/orgForm?groupId="+groupId+"&isGroupOptions=0",
	// 	success: function(layero, index){
	// 	},end:function (){
	// 	}
	// })
}
</script>